YUI.add("moodle-availability_gwpayments-form",function(o,e){M.availability_gwpayments=M.availability_gwpayments||{},M.availability_gwpayments.form=o.Object(M.core_availability.plugin),M.availability_gwpayments.form.initInner=function(e,t,a){this.currencies=e,this.accounts=t,this.defaults=a},M.availability_gwpayments.form.getNode=function(e){var t,a,i,n,l,s,c="";for(t in this.currencies)c+='<option value="'+t+'" '+(e.currency===t||e.currency===undefined&&this.defaults.currency!==undefined&&this.defaults.currency===t?' selected="selected"':"")+" >",c+=this.currencies[t],c+="</option>";for(i in a="",this.accounts)a+='<option value="'+i+'" '+(e.accountid===i?' selected="selected" ':"")+" >",a+=this.accounts[i],a+="</option>";return n="",n+="<div><label>",n+=M.util.get_string("paymentaccount","availability_gwpayments"),n+='<select name="accountid" />'+a+"</select>",n+="</label></div>",n+="<div><label>",n+=M.util.get_string("currency","availability_gwpayments"),n+='<select name="currency" />'+c+"</select>",n+="</label></div>",n+="<div><label>",n+=M.util.get_string("cost","availability_gwpayments"),n+='<input name="cost" type="text" />',n+="</label></div>",n+="<div><label>",n+=M.util.get_string("vat","availability_gwpayments"),n+='<input name="vat" type="text" />',n+="</label></div>",l=o.Node.create("<span>"+n+"</span>"),e.cost!==undefined?l.one("input[name=cost]").set("value",e.cost):this.defaults.cost!==undefined&&l.one("input[name=cost]").set("value",this.defaults.cost),e.vat!==undefined?l.one("input[name=vat]").set("value",e.vat):this.defaults.vat!==undefined&&l.one("input[name=vat]").set("value",this.defaults.vat),M.availability_gwpayments.form.addedEvents||(M.availability_gwpayments.form.addedEvents=!0,(s=o.one("#fitem_id_availabilityconditionsjson")).delegate("change",function(){M.core_availability.form.update()},".availability_gwpayments select[name=accountid]"),s.delegate("change",function(){M.core_availability.form.update()},".availability_gwpayments select[name=currency]"),s.delegate("valuechange",function(){M.core_availability.form.update()},".availability_gwpayments input")),l},M.availability_gwpayments.form.fillValue=function(e,t){e.accountid=t.one("select[name=accountid]").get("value"),e.currency=t.one("select[name=currency]").get("value"),e.cost=this.getValue("cost",t),e.vat=this.getValue("vat",t)},M.availability_gwpayments.form.getValue=function(e,t){var a=t.one("input[name="+e+"]").get("value");return/^[0-9]+([.,][0-9]+)?$/.test(a)?parseFloat(a.replace(",",".")):a},M.availability_gwpayments.form.fillErrors=function(e,t){var a={};this.fillValue(a,t),(a.cost!==undefined&&"string"==typeof a.cost||a.cost<=0)&&e.push("availability_gwpayments:error_cost"),(a.vat!==undefined&&"string"==typeof a.vat||a.vat<0||100<a.vat)&&e.push("availability_gwpayments:error_vat")}},"@VERSION@",{requires:["base","node","event","moodle-core_availability-form"]});